/*
 * Set application settings to file 
*/

package com.costeaalex.blueserver.settings;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class AppSettingsSet
	{
	
	private File f=new File("Settings.dat");
	private FileOutputStream fR;
	private ObjectOutputStream oIS;
	
	public AppSettingsSet()
		{
		
		}
	
	public boolean setSettings(Settings sO)
		{
		if(!f.exists())
			{
			try
				{
				f.createNewFile();
				} 
			catch (IOException e)
				{
				e.printStackTrace();
				}
			}
		
		try
			{
			fR=new FileOutputStream(f.getAbsolutePath());
			oIS=new ObjectOutputStream(fR);
			oIS.writeObject(sO);
			return true;
			} 
		catch (Exception e)
			{
			e.printStackTrace();
			}
		
		return false;
		}
	
	}
